/**
 * SPDX-FileCopyrightText: 2023-2025 Sangfor Technologies Inc.
 * SPDX-License-Identifier: Mulan PSL v2
 */
<template>
    <div class="page-title"
         :class="{'border-none':borderNone}"
         :style="{'background':bgColor}">
        <div class="title-left">
            <span v-if="returnBtn"
                  :title="returnTitle"
                  class="icon iconfont iconsip-return"
                  @click="_return"></span>
            <div class="title"
                 :class="{'small-size':smallSize}">
                <lang>{{ titleName }}</lang>
            </div>
        </div>
        <div class="title-right">
            <slot></slot>
        </div>
    </div>
</template>

<style lang="less">
.page-title {
    margin:0 12px;
    height: 48px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #ddd;
    background: #fff;
    justify-content: space-between;
    &.border-none{
        border-bottom: none;
    }
    .title-left{
        display: flex;
    }
    .iconsip-return{
        font-size: 18px;
        cursor: pointer;
        color: #204ED9;
        position: relative;
        margin-top: 3px;
        margin-right: 20px;
        padding-right: 4px;
        &::after{
            content: '';
            background: #E0E0E0;
            width: 1px;
            height: 16px;
            position: absolute;
            left: 29px;
            top: 3px;
        }
        // &:hover{
        //    color: #204ED9;
        // }
    }
    .title {
        font-size: 16px;
        color: #14161A;
        font-weight: bold;
        &.small-size{
            font-size: 14px
        }

    }
}
</style>

<script>
export default {
    name: 'PageTitle',

    props: {
        titleName: String,
        smallSize:{
            type:Boolean,
            default:false
        },
        borderNone:{
            type:Boolean,
            default:false
        },
        bgColor:{
            type:String,
            default:'#fff'
        },
        returnBtn:{
            type:Boolean,
            default:false
        },
        returnTitle:{
            type:String,
            default:''
        }
    },
    methods:{
        _return () {
            this.$emit('return');
        }
    }
};
</script>
